{% extends  'basic/header.html'%}
    {% block body %}
    <div class="row m-row">
        <div class="col-sm-2 col-md-2 sidebar" id="teacleftsidebar">
          <ul class="nav nav-sidebar m-lsts-navlt">
            <li class="m-lst-navlt">
                <a href="javascript:void(0)">
                    <img src="../..{{ request.user.avatar }}" alt="" class="u-headimg-left">
{#                    <p class="u-name-navlt u-user-name">{{ request.user.username }}</p>#}
                    <p class="u-name-navlt">{{ request.user.realname }}</p>
                </a>
            </li>
          </ul>
          {#管理学生账号 start#}
          <ul class="nav nav-sidebar nav-sidebar-teacher m-navsidber-l">
            <li class="active"><a href="/teacher/home/">学生档案</a></li>
            <li><a href="/teacher/scalelist/?uid=">现场测评</a></li>
            <li><a href="javascript:void(0)">训练内容</a></li>
          </ul>
          {#管理学生账号 end#}
          {#version start#}
          <div class="m-version-wrap">
              <p class="u-version-num">Version  1.0.0</p>
              <p class="m-version-66nao">2016 <span class="u-icon-ver"></span>六六脑</p>
          </div>
          {#version end#}
        </div>
        <div class="col-sm-10  col-md-10 main m-main-nonav m-main-tab">
            <div class="row f-text-right">
            <div class="col-xs-8 col-sm-8 placeholder m-wrap-formsch">
                <form class="form-search m-form-sch">
                    <div class="row">
                        <div class="col-xs-7 col-sm-7 m-wrap-searl"><input type="text" class="form-control" placeholder="请输入学生姓名搜索..." id="keyword" name="search" value="{{ keyword }}"></div>
                        <div class="col-xs-4 col-sm-4 m-wrap-searr">
                            <input class="btn btn-primary m-search-user" type="submit" value="搜索">
                        </div>
                    </div>
                </form>
            </div>
            <div class="col-xs-4 col-sm-4 placeholder m-pad-40">
                <button class="btn btn-primary u-btn-create u-btn-blue" type="button">新建档案</button>
            </div>
          </div>
          <!--<h2 class="sub-header">档案列表</h2>-->
          <div class="table-responsive">
                <table class="table table-striped">
                  <thead class="m-thead-table">
                    <tr>
                      <th>学生姓名</th>
                      <th>性别</th>
                      <th>年龄</th>
                      <th>测评</th>
                      <th>学生信息</th>
                    </tr>
                  </thead>
                  <tbody id="tbody_list" class="m-body-table">
                  {% if stulists %}
                  {% for student in stulists %}
                  <tr>
                      <td>
                          <a class="btn u-uname-basic" href="/teacher/student/?uid={{ student.id }}" style="background-color:
                          {% ifchanged student.id %}
                                  {% cycle '#1BBE9F' '#F6A623' '#E8570F' '#4990E2' %}
                              {% else %}
                                    '#F6A623'
                          {% endifchanged %}
                          ;">{{ student.realname  | slice:"-2:" }}</a>
                          <a href="/teacher/student/?uid={{ student.id }}" class="u-uinfo-top u-user-name">{{ student.realname }}</a>
                      </td>
                      <td>
                          {% if student.sex == 1 %}
                            女
                          {% elif student.sex == 2 %}
                            男
                          {% else %}
                            其他
                          {% endif %}
                      </td>
                      <td>{{ student.age }}</td>
                      <td><a href="/teacher/scalelist/?uid={{ student.id }}">立即测评</a></td>
{#                      <td onclick="startEva({{ student.id }})">立即测评</td>#}
                      <td><a href="/teacher/student/?uid={{ student.id }}">查看</a></td>
                    </tr>
                  {% endfor %}
                      {% elif list_len == 0 and keyword != '' %}
                      <tr><td colspan="5" class="u-hasno-info">未找到符合条件的学生信息！</td></tr>
                      {% else %}
                      <tr><td colspan="5" class="u-hasno-info">当前无学生信息，请新建学生档案！</td></tr>
                  {% endif %}
                  </tbody>
                </table>
                {% if stulists %}
                    {% if list_len > 10 %}
                        {% include "basic/paginator.html" %}
                    {% endif %}
                {% endif %}
                <p class="u-hasno-search fn-hide">未找到符合条件的学生信息！</p>
          </div>
          {#分页 start#}
{#          {% include "basic/paginator.html" %}#}
          {#分页 end#}
       </div>
    </div>
    <div class="m-black-mask fn-hide"></div>
    <div class="row m-wrap-teacher">
        <div class="m-mask-teacher col-sm-9 fn-hide">
            <div class="modal-header m-header-teacher">
                  <button class="u-close-mask">×</button>
                  <h4 class="u-tlt-modal">新建学生档案</h4>
            </div>
            <form class="form-new-stu m-form-stu">
                  <div class="m-body-mask">
{#                    <p class="u-tip"></p>#}
                    <div class="form-group">
                      <label for="user-real-name" class="control-label m-label-modal">学生姓名<span class="star-red">*</span></label>
                      <div>
                        <input type="text" class="form-control u-in realname" id="user-real-name" name="realname" data-tip="请输入20以内个字符" >
                        <p class="u-tip-form"></p>
                      </div>
                    </div>
                    <div class="form-group">
                      <label class="control-label control-label m-label-modal">性别<span class="star-red">*</span></label>
                      <div class="m-wrap-sex clearfix">
                        <label for="user-gender-female" class="control-label-gender fn-left cur">男
                          <input type="radio" class="" id="user-gender-female" name="gender" value="2" checked>
                        </label>
                        <label for="user-gender-male" class="control-label-gender fn-left">女
                          <input type="radio" class="" id="user-gender-male" name="gender" value="1">
                        </label>
                        <label for="user-gender-other" class="control-label-gender fn-left">其他
                          <input type="radio" class="" id="user-gender-other" name="gender" value="9">
                        </label>
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="user-age" class="control-label m-label-modal">年龄<span class="star-red">*</span></label>
                      <div class="">
                        <input type="text" class="form-control u-in age" id="user-age" name="age"  data-tip="请输入1-100的数字">
                        <p class="u-tip-form"></p>
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="user-edu" class="control-label m-label-modal">年级<span class="star-red">*</span></label>
                      <div class="">
                        <select class="form-control u-in education" id="user-edu" name="education" data-tip="请选择年级">
                            <option value="0">请选择</option>
                            <option value="1">未入园</option>
                            <option value="2">小班</option>
                            <option value="3">中班</option>
                            <option value="4">大班</option>
                            <option value="5">一年级</option>
                            <option value="6">二年级</option>
                            <option value="7">三年级</option>
                            <option value="8">四年级</option>
                            <option value="9">五年级</option>
                            <option value="10">六年级</option>
                            <option value="11">初中</option>
                        </select>
                        <p class="u-tip-form"></p>
                      </div>
                    </div>
                        <input type="hidden" class="form-control tel" id="user-tel" name="telephone"  value="" data-tip="请输入正确的手机号">
                    <div>
                        <input type="hidden" value="1" name="hand"/>
                        <input type="hidden" value="2017-5-22" name="expire"/>
                        <input type="hidden" value="" name="birthday"/>
                        <input type="hidden" value="" name="access_token"/>
                        <input type="hidden" value="{{ request.user.id }}" name="adduid"/>
                    </div>
                  </div>
                  <div class="modal-footer m-mask-footer clearfix">
                    <input type="submit" value="保存" class="btn btn-save u-btn-mask fn-left"></input>
                    <button class="btn u-btn-cancel u-btn-mask fn-right">取消</button>
                  </div>
            </form>
        </div>
    </div>
    {# 新建档案弹框 start #}
{#    <div class="modal fade modal-teacher">#}
{#        <div class="modal-dialog modal-lg">#}
{#          <div class="modal-content">#}
{#            <div class="modal-header m-header-teacher">#}
{#              <button class="close" data-dismiss="modal">×</button>#}
{#              <h4 class="u-tlt-modal">新建学生档案</h4>#}
{#            </div><!--modal-header,弹出层头部区域-->#}
{#            <form class="form-horizontal form-new-stu row" id="newtab">#}
{#              <div class="col-xs-4 col-xs-push-4">#}
{#                  <div class="modal-body">#}
{#                    <p class="u-tip"></p>#}
{#                    <div class="form-group">#}
{#                      <label for="user-real-name" class="control-label m-label-modal">学生姓名<span class="star-red">*</span></label>#}
{#                      <div>#}
{#                        <input type="text" class="form-control u-in realname" id="user-real-name" placeholder="学生姓名" name="realname" data-tip="请输入20以内个字符" >#}
{#                      </div>#}
{#                    </div>#}
{#                    <div class="form-group">#}
{#                      <label class="control-label control-label m-label-modal">性别<span class="star-red">*</span></label>#}
{#                      <div class="">#}
{#                        <label for="user-gender-female" class="col-sm-3 control-label control-label-gender">#}
{#                          <input type="radio" class="" id="user-gender-female" name="gender" value="2" checked>#}
{#                        男</label>#}
{#                        <label for="user-gender-male" class="col-sm-3 control-label control-label-gender">#}
{#                          <input type="radio" class="" id="user-gender-male" name="gender" value="1">#}
{#                        女</label>#}
{#                        <label for="user-gender-other" class="col-sm-3 control-label control-label-gender">#}
{#                          <input type="radio" class="" id="user-gender-other" name="gender" value="9">#}
{#                        其他</label>#}
{#                      </div>#}
{#                    </div>#}
{#                    <div class="form-group">#}
{#                      <label for="user-age" class="control-label m-label-modal">年龄<span class="star-red">*</span></label>#}
{#                      <div class="">#}
{#                        <input type="text" class="form-control u-in age" id="user-age" placeholder="年龄（1-100）" name="age"  data-tip="请输入1-100的数字">#}
{#                      </div>#}
{#                    </div>#}
{#                    <div class="form-group">#}
{#                      <label for="user-edu" class="control-label m-label-modal">年级<span class="star-red">*</span></label>#}
{#                      <div class="">#}
{#                        <select class="form-control u-in education" id="user-edu" name="education" data-tip="请选择年级">#}
{#                            <option value="0">请选择</option>#}
{#                            <option value="1">未入园</option>#}
{#                            <option value="2">小班</option>#}
{#                            <option value="3">中班</option>#}
{#                            <option value="4">大班</option>#}
{#                            <option value="5">一年级</option>#}
{#                            <option value="6">二年级</option>#}
{#                            <option value="7">三年级</option>#}
{#                            <option value="8">四年级</option>#}
{#                            <option value="9">五年级</option>#}
{#                            <option value="10">六年级</option>#}
{#                            <option value="11">初中</option>#}
{#                        </select>#}
{#                      </div>#}
{#                    </div>#}
    {#                <div class="form-group">#}
    {#                  <label for="user-tel" class="col-sm-2 control-label">手机号<span class="star-red">*</span></label>#}
    {#                  <div class="col-sm-10">#}
{#                        <input type="hidden" class="form-control tel" id="user-tel" placeholder="手机号（11位有效数字）" name="telephone"  value="" data-tip="请输入正确的手机号">#}
    {#                  </div>#}
    {#                </div>#}
{#                    <div>#}
{#                        <input type="hidden" value="1" name="hand"/>#}
{#                        <input type="hidden" value="2017-5-22" name="expire"/>#}
{#                        <input type="hidden" value="" name="birthday"/>#}
{#                        <input type="hidden" value="" name="access_token"/>#}
{#                        <input type="hidden" value="{{ request.user.id }}" name="adduid"/>#}
{#                    </div>#}
{#                  </div>#}
{#                  <div class="modal-footer">#}
{#                    <button class="btn btn-default u-btn-cancel" data-dismiss="modal">取消</button>#}
                    {#onclick="subNewtab()"#}
{#                    <input type="submit" value="保存" class="btn btn-primary btn-save"></input>#}
{#                  </div>#}
{#              </div>#}
{#            </form>#}
{##}
{#          </div>#}
{#        </div>#}
{#    </div>#}
    {% endblock %}
    {% block script %}
    <script>
        seajs.use(['/static/js/app/teacher/search', '/static/js/app/teacher/teacher'], function(search, teacher){
            search.init();
            teacher.init({
                access_token: 'input[name=access_token]',
                form: '.form-new-stu',
                search: '.form-search'
            });
        })
{#        function startEva(uid) {#}
{#            location.href="/teacher/scalelist/?uid="+uid;#}
{#        }#}
{#        function subNewtab() {#}
{#            forms = $("#newtab").serializeArray();#}
{#            console.log(forms);#}
{#            $.ajax({#}
{#                type:'POST',#}
{#                url:'/teacher/newtab/',#}
{#                dataType:'json',#}
{#                data:{#}
{#                  //'forms': forms,#}
{#                    username:$("#user-name").val(),#}
{#                    age:$("#user-age").val(),#}
{#                    grade:$("#user-edu").val(),#}
{#                    sex:$("input[name='gender']:checked").val(),#}
{#                    utype:'3',#}
{#                    adduid:{{ request.user.id }}#}
{#                },#}
{#                success:function (response) {#}
{#                    console.log(response);#}
{#                    if(response == '200'){#}
{#                        location.href="/teacher/home";#}
{#                    }#}
{#                }#}
{#            });#}
{#            return false;#}
{#        }#}
    </script>
    {% endblock %}